{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 第2章  数据的收集与整理"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.1  数据的类型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　2.1.1  按度量尺度分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.1.1.1 定性数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "性别:女,男,男,女,男,男,女,男,女,男,女,男,女,女,男"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['女', '男', '男', '女', '男', '男', '女', '男', '女', '男', '女', '男', '女', '女', '男']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "性别=['女','男','男','女','男','男','女','男','女','男','女','男','女','女','男'];性别"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['女', '男', '男', '女', '男', '男', '女', '男', '女', '男', '女', '男', '女', '女', '男']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex=['女','男','男','女','男','男','女','男','女','男','女','男','女','女','男'];sex"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.1.1.2 定量数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "体重:67,66,83,68,70,90,70,58,63,72,65,76,71,66,77"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[67, 66, 83, 68, 70, 90, 70, 58, 63, 72, 65, 76, 71, 66]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "体重=[67,66,83,68,70,90,70,58,63,72,65,76,71,66];体重"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[67, 66, 83, 68, 70, 90, 70, 58, 63, 72, 65, 76, 71, 66]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "weight=[67,66,83,68,70,90,70,58,63,72,65,76,71,66];weight"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　2.1.2  按时间状况分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.1.2.1 纵向数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.1.2.2 面板数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.2  数据的收集"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　2.2.1 横向数据的收集"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用问卷星设计网络化调查问卷，进入问卷星 https://www.wjx.cn 网站可快速设计。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>学号</th>\n",
       "      <th>性别</th>\n",
       "      <th>身高</th>\n",
       "      <th>体重</th>\n",
       "      <th>支出</th>\n",
       "      <th>开设</th>\n",
       "      <th>课程</th>\n",
       "      <th>软件</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1510248008</td>\n",
       "      <td>女</td>\n",
       "      <td>167</td>\n",
       "      <td>71</td>\n",
       "      <td>46.0</td>\n",
       "      <td>不清楚</td>\n",
       "      <td>都未学过</td>\n",
       "      <td>No</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1510229019</td>\n",
       "      <td>男</td>\n",
       "      <td>171</td>\n",
       "      <td>68</td>\n",
       "      <td>10.4</td>\n",
       "      <td>有必要</td>\n",
       "      <td>概率统计</td>\n",
       "      <td>Matlab</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1512108019</td>\n",
       "      <td>女</td>\n",
       "      <td>175</td>\n",
       "      <td>73</td>\n",
       "      <td>21.0</td>\n",
       "      <td>有必要</td>\n",
       "      <td>统计方法</td>\n",
       "      <td>SPSS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1512332010</td>\n",
       "      <td>男</td>\n",
       "      <td>169</td>\n",
       "      <td>74</td>\n",
       "      <td>4.9</td>\n",
       "      <td>有必要</td>\n",
       "      <td>编程技术</td>\n",
       "      <td>Excel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1512331015</td>\n",
       "      <td>男</td>\n",
       "      <td>154</td>\n",
       "      <td>55</td>\n",
       "      <td>25.9</td>\n",
       "      <td>有必要</td>\n",
       "      <td>都学习过</td>\n",
       "      <td>Python</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>1538319004</td>\n",
       "      <td>男</td>\n",
       "      <td>175</td>\n",
       "      <td>68</td>\n",
       "      <td>44.4</td>\n",
       "      <td>不清楚</td>\n",
       "      <td>统计方法</td>\n",
       "      <td>SAS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>1538254010</td>\n",
       "      <td>女</td>\n",
       "      <td>166</td>\n",
       "      <td>65</td>\n",
       "      <td>5.3</td>\n",
       "      <td>不清楚</td>\n",
       "      <td>编程技术</td>\n",
       "      <td>Python</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>1540294017</td>\n",
       "      <td>女</td>\n",
       "      <td>159</td>\n",
       "      <td>58</td>\n",
       "      <td>71.4</td>\n",
       "      <td>不清楚</td>\n",
       "      <td>都学习过</td>\n",
       "      <td>SPSS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>1540365026</td>\n",
       "      <td>女</td>\n",
       "      <td>169</td>\n",
       "      <td>73</td>\n",
       "      <td>5.5</td>\n",
       "      <td>有必要</td>\n",
       "      <td>统计方法</td>\n",
       "      <td>Excel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>1540388036</td>\n",
       "      <td>女</td>\n",
       "      <td>165</td>\n",
       "      <td>67</td>\n",
       "      <td>56.8</td>\n",
       "      <td>不必要</td>\n",
       "      <td>概率统计</td>\n",
       "      <td>SAS</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>52 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            学号 性别   身高  体重    支出   开设    课程      软件\n",
       "0   1510248008  女  167  71  46.0  不清楚  都未学过      No\n",
       "1   1510229019  男  171  68  10.4  有必要  概率统计  Matlab\n",
       "2   1512108019  女  175  73  21.0  有必要  统计方法    SPSS\n",
       "3   1512332010  男  169  74   4.9  有必要  编程技术   Excel\n",
       "4   1512331015  男  154  55  25.9  有必要  都学习过  Python\n",
       "..         ... ..  ...  ..   ...  ...   ...     ...\n",
       "47  1538319004  男  175  68  44.4  不清楚  统计方法     SAS\n",
       "48  1538254010  女  166  65   5.3  不清楚  编程技术  Python\n",
       "49  1540294017  女  159  58  71.4  不清楚  都学习过    SPSS\n",
       "50  1540365026  女  169  73   5.5  有必要  统计方法   Excel\n",
       "51  1540388036  女  165  67  56.8  不必要  概率统计     SAS\n",
       "\n",
       "[52 rows x 8 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "pd.set_option('display.max_rows', 10)\n",
    "pd.read_excel('DaPy_data.xlsx','BSdata')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　2.2.2 纵向数据的收集"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "例2.2 季节数据：经济数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year</th>\n",
       "      <th>Q1</th>\n",
       "      <th>Q2</th>\n",
       "      <th>Q3</th>\n",
       "      <th>Q4</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2001</td>\n",
       "      <td>2.330</td>\n",
       "      <td>2.565</td>\n",
       "      <td>2.687</td>\n",
       "      <td>3.384</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2002</td>\n",
       "      <td>2.536</td>\n",
       "      <td>2.797</td>\n",
       "      <td>2.972</td>\n",
       "      <td>3.728</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2003</td>\n",
       "      <td>2.886</td>\n",
       "      <td>3.101</td>\n",
       "      <td>3.346</td>\n",
       "      <td>4.249</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2004</td>\n",
       "      <td>3.342</td>\n",
       "      <td>3.699</td>\n",
       "      <td>3.956</td>\n",
       "      <td>4.991</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2005</td>\n",
       "      <td>3.912</td>\n",
       "      <td>4.280</td>\n",
       "      <td>4.474</td>\n",
       "      <td>5.828</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2011</td>\n",
       "      <td>9.748</td>\n",
       "      <td>10.901</td>\n",
       "      <td>11.586</td>\n",
       "      <td>15.076</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2012</td>\n",
       "      <td>10.837</td>\n",
       "      <td>11.963</td>\n",
       "      <td>12.574</td>\n",
       "      <td>16.573</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2013</td>\n",
       "      <td>11.886</td>\n",
       "      <td>12.916</td>\n",
       "      <td>13.908</td>\n",
       "      <td>20.092</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2014</td>\n",
       "      <td>12.821</td>\n",
       "      <td>14.083</td>\n",
       "      <td>15.086</td>\n",
       "      <td>21.656</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>2015</td>\n",
       "      <td>14.067</td>\n",
       "      <td>17.351</td>\n",
       "      <td>17.316</td>\n",
       "      <td>18.937</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>15 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Year      Q1      Q2      Q3      Q4\n",
       "0   2001   2.330   2.565   2.687   3.384\n",
       "1   2002   2.536   2.797   2.972   3.728\n",
       "2   2003   2.886   3.101   3.346   4.249\n",
       "3   2004   3.342   3.699   3.956   4.991\n",
       "4   2005   3.912   4.280   4.474   5.828\n",
       "..   ...     ...     ...     ...     ...\n",
       "10  2011   9.748  10.901  11.586  15.076\n",
       "11  2012  10.837  11.963  12.574  16.573\n",
       "12  2013  11.886  12.916  13.908  20.092\n",
       "13  2014  12.821  14.083  15.086  21.656\n",
       "14  2015  14.067  17.351  17.316  18.937\n",
       "\n",
       "[15 rows x 5 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.read_excel('DaPy_data.xlsx','YQdata') #横向表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>YQ</th>\n",
       "      <th>GDP</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2001Q1</td>\n",
       "      <td>2.330</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2001Q2</td>\n",
       "      <td>2.565</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2001Q3</td>\n",
       "      <td>2.687</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2001Q4</td>\n",
       "      <td>3.384</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2002Q1</td>\n",
       "      <td>2.536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>2014Q4</td>\n",
       "      <td>21.656</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>2015Q1</td>\n",
       "      <td>14.067</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>2015Q2</td>\n",
       "      <td>17.351</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>2015Q3</td>\n",
       "      <td>17.316</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>2015Q4</td>\n",
       "      <td>18.937</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>60 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        YQ     GDP\n",
       "0   2001Q1   2.330\n",
       "1   2001Q2   2.565\n",
       "2   2001Q3   2.687\n",
       "3   2001Q4   3.384\n",
       "4   2002Q1   2.536\n",
       "..     ...     ...\n",
       "55  2014Q4  21.656\n",
       "56  2015Q1  14.067\n",
       "57  2015Q2  17.351\n",
       "58  2015Q3  17.316\n",
       "59  2015Q4  18.937\n",
       "\n",
       "[60 rows x 2 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.read_excel('DaPy_data.xlsx','QTdata') #纵向表"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "例2.3  日期数据：股票数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>Open</th>\n",
       "      <th>High</th>\n",
       "      <th>Low</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Adjusted</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2005-01-03</td>\n",
       "      <td>0.70247</td>\n",
       "      <td>0.71728</td>\n",
       "      <td>0.70247</td>\n",
       "      <td>0.71296</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.618499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2005-01-04</td>\n",
       "      <td>0.70988</td>\n",
       "      <td>0.72145</td>\n",
       "      <td>0.69414</td>\n",
       "      <td>0.69599</td>\n",
       "      <td>10958717.0</td>\n",
       "      <td>0.603777</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2005-01-05</td>\n",
       "      <td>0.69506</td>\n",
       "      <td>0.70818</td>\n",
       "      <td>0.69506</td>\n",
       "      <td>0.70525</td>\n",
       "      <td>6165072.0</td>\n",
       "      <td>0.611810</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2005-01-06</td>\n",
       "      <td>0.70231</td>\n",
       "      <td>0.70648</td>\n",
       "      <td>0.69614</td>\n",
       "      <td>0.69676</td>\n",
       "      <td>9845971.0</td>\n",
       "      <td>0.604445</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2005-01-07</td>\n",
       "      <td>0.69599</td>\n",
       "      <td>0.70957</td>\n",
       "      <td>0.69460</td>\n",
       "      <td>0.70201</td>\n",
       "      <td>13667162.0</td>\n",
       "      <td>0.608999</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3175</th>\n",
       "      <td>2017-12-25</td>\n",
       "      <td>12.73000</td>\n",
       "      <td>12.74000</td>\n",
       "      <td>12.25000</td>\n",
       "      <td>12.38000</td>\n",
       "      <td>65681626.0</td>\n",
       "      <td>12.380000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3176</th>\n",
       "      <td>2017-12-26</td>\n",
       "      <td>12.46000</td>\n",
       "      <td>12.54000</td>\n",
       "      <td>12.37000</td>\n",
       "      <td>12.52000</td>\n",
       "      <td>30913299.0</td>\n",
       "      <td>12.520000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3177</th>\n",
       "      <td>2017-12-27</td>\n",
       "      <td>12.54000</td>\n",
       "      <td>12.57000</td>\n",
       "      <td>12.10000</td>\n",
       "      <td>12.18000</td>\n",
       "      <td>53813380.0</td>\n",
       "      <td>12.180000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3178</th>\n",
       "      <td>2017-12-28</td>\n",
       "      <td>12.20000</td>\n",
       "      <td>12.28000</td>\n",
       "      <td>12.06000</td>\n",
       "      <td>12.18000</td>\n",
       "      <td>33692919.0</td>\n",
       "      <td>12.180000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3179</th>\n",
       "      <td>2017-12-29</td>\n",
       "      <td>12.18000</td>\n",
       "      <td>12.33000</td>\n",
       "      <td>12.14000</td>\n",
       "      <td>12.29000</td>\n",
       "      <td>25372331.0</td>\n",
       "      <td>12.290000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3180 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           date      Open      High       Low     Close      Volume   Adjusted\n",
       "0    2005-01-03   0.70247   0.71728   0.70247   0.71296         0.0   0.618499\n",
       "1    2005-01-04   0.70988   0.72145   0.69414   0.69599  10958717.0   0.603777\n",
       "2    2005-01-05   0.69506   0.70818   0.69506   0.70525   6165072.0   0.611810\n",
       "3    2005-01-06   0.70231   0.70648   0.69614   0.69676   9845971.0   0.604445\n",
       "4    2005-01-07   0.69599   0.70957   0.69460   0.70201  13667162.0   0.608999\n",
       "...         ...       ...       ...       ...       ...         ...        ...\n",
       "3175 2017-12-25  12.73000  12.74000  12.25000  12.38000  65681626.0  12.380000\n",
       "3176 2017-12-26  12.46000  12.54000  12.37000  12.52000  30913299.0  12.520000\n",
       "3177 2017-12-27  12.54000  12.57000  12.10000  12.18000  53813380.0  12.180000\n",
       "3178 2017-12-28  12.20000  12.28000  12.06000  12.18000  33692919.0  12.180000\n",
       "3179 2017-12-29  12.18000  12.33000  12.14000  12.29000  25372331.0  12.290000\n",
       "\n",
       "[3180 rows x 7 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "pd.read_excel('DaPy_data.xlsx','Stock')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.3  数据的管理"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　2.3.1 表格管理数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　2.3.2 数据库管理数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　2.3.3 Python数据管理"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
